package com.sakiko.audiobook.user.service;


import com.baomidou.mybatisplus.extension.service.IService;
import com.sakiko.audiobook.model.user.UserInfo;
import com.sakiko.audiobook.vo.user.UserInfoVo;
import com.sakiko.audiobook.vo.user.UserPaidRecordVo;

import java.util.List;
import java.util.Map;

public interface UserInfoService extends IService<UserInfo> {

    /**
     * 微信登陆
     *
     * @param code
     * @return
     */
    Map<String, Object> wxLogin(String code);

    /**
     * 根据用户 id，获取用户信息
     *
     * @param userId
     * @return
     */
    UserInfoVo getUserInfo(Long userId);

    /**
     * 更新用户信息
     *
     * @param userInfoVo
     * @param userId
     */
    void updateUser(UserInfoVo userInfoVo, Long userId);

    /**
     * 判断用户是否购买声音列表
     *
     * @param userId
     * @param albumId
     * @param trackIdList
     * @return
     */
    Map<Long, Integer> userIsPaidTrack(Long userId, Long albumId, List<Long> trackIdList);

    /**
     * 判断用户是否购买专辑
     *
     * @param albumId
     * @param userId
     * @return
     */
    Boolean isPaidAlbum(Long albumId, Long userId);

    /**
     * 获取用户已购买的声音列表
     * @param albumId
     * @param userId
     * @return
     */
    List<Long> findUserPaidTrackList(Long albumId, Long userId);

    /**
     * 处理用户购买记录
     * @param userPaidRecordVo
     */
    void savePaidRecord(UserPaidRecordVo userPaidRecordVo);
}
